package com.broada.apm.util;

import java.util.HashMap;
import java.util.Map;

public class CachedItemManager {
	private static final CachedItemManager CACHED_ITEM_MANAGER = new CachedItemManager();
	private static Map<String, HashMap<?, ?>> cachedMaps = new HashMap<String, HashMap<?, ?>>();

	private CachedItemManager() {

	}

	public static CachedItemManager getInstance() {
		return CACHED_ITEM_MANAGER;
	}

	public <KA, VA> Map<KA, VA> getManager(String name) {
		if (!cachedMaps.containsKey(name)) {
			HashMap<KA, VA> value = new HashMap<KA, VA>();
			cachedMaps.put(name, value);
		}
		return (Map<KA, VA>) cachedMaps.get(name);
	}
}
